# if 1 > 2:
#     print("1>2")
# else:
#     print("1<=2")

"""
模拟上网
"""
# age = 20
# if age >= 18:
#     print("已成年,可以上网")
# else:
#     print("未成年,不允许上网")
#
# print("系统关闭")


"""
模拟上网（进阶版）
"""
# user_age = int(input("请输入年龄:"))
#
# if user_age >= 18:
#     print("您已成年,可以上网")
# else:
#     print("未成年,不允许上网")
#
# print("系统关闭")

"""
多重判断
"""
# work_age = int(input("请输入您的年龄:"))
# if age > 60:
#     print(f"您的年龄{work_age},已达到退休年龄")
# elif age > 18:
#     print(f"您的年龄{work_age}为合法工龄")
# else:
#     print(f"您的年龄为{work_age},不可工作")

"""
if 嵌套
"""
# money = 10
# seat = -1
# if money >= 10:
#     print("有足够的钱,上车")
#     if seat >= 1:
#         print("可以坐下")
#     else:
#         print("没有座位了")
# else:
#     print("没有足够的钱")


"""
猜拳游戏
写法一
写法二
"""
import random

player = int(input("请出拳：0-石头,1-剪刀,2-布："))
computer = random.randint(0, 2)
print(f"电脑出拳：{computer}")
# 写法一
if player == 0:
    if computer == 0:
        print("平局")
    elif computer == 1:
        print("玩家赢")
    else:
        print("电脑赢")
elif player == 1:
    if computer == 0:
        print("电脑赢")
    elif computer == 1:
        print("平局")
    else:
        print("玩家赢")
else:
    if computer == 0:
        print("玩家赢")
    elif computer == 1:
        print("电脑赢")
    else:
        print("平局")
# 写法二
if ((player == 0) and (computer == 1)) or ((player == 1) and (computer == 2)) or ((player == 2) and (computer == 0)):
    print("玩家赢")
elif ((player == 0) and (computer == 0)) or ((player == 1) and (computer == 0)) or ((player == 2) and (computer == 0)):
    print("平局")
else:
    print("电脑赢")

"""
三目运算符
语法: 成立表达式 if 判断语句 else 不成立表达式
"""
a = 1
b = 2
c = a if a > b else b
print(c)
